home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Localization / Verifier 1.0 / v.FileList < prev    next >
Encoding:
Text File  |  1993-06-24  |  2.5 KB  |  69 lines  |  [TEXT/MPS ]

  1. #
  2. #    v.FileList
  3. #    MPW Shell script
  4. #    Kerry Laidlaw
  5. #    Apple Computer, Inc.
  6. #
  7. #    Function:
  8. #    Help the user build a list of corresponding files from a
  9. #    master to a test disk.  It does this by generating a list
  10. #    of the files on the two disks and asking the user (via dialog
  11. #    boxes) for the names of the test files that it cannot figure out.
  12. #
  13.  
  14. #    Save some initial shell variable values, and set them for our own use
  15.  
  16.     set saveExit    {exit}
  17.     set exit    0        # Set exit 0 so we won't abort if status variable is non-zero
  18.     set saveEcho {echo}    # echo=1 for echoing each command before execution
  19.     set echo 0
  20.     set saveDir `directory`
  21.  
  22.     directory "{MasterFolder}"
  23.     directory ::
  24.  
  25. #    delete -y -i "{FileList}"    # Delete the list if it exists already
  26.     
  27. #    Get the file list for the US disk.  The options ask for recursive
  28. #    search, full pathnames, and files only.  The output file is a temp file.
  29. files -r -f -s "{TestFolder}" > "{FileList}".loc
  30.  
  31. #    Loop on the localized files and prompt the user for the test files we cannot
  32. #    figure out.  Use the type and creator of the US files to search for the 
  33. #    test file.  If we find only one, it must be the file we're looking for.
  34. #    If we find more than one, ask the user for help.  
  35.  
  36. for file in `catenate "{FileList}".loc`
  37.     continue if "{file}" =~ /≈Desktop/        # Skip the desktop file.
  38.     # Search the TestFolder.  The output of this files should NOT be quoted (-q).
  39.     # Remember to quote the creator to include possible trailing spaces!
  40.     files -r -f -s -q -t `catinfo -t -q "{file}"` -c "`catinfo -c -q "{file}"`" "{MasterFolder}" > "{FileList}".us
  41.     if `count -l "{FileList}".us` == 1    # If only one line of output
  42.         catenate "{FileList}".us >> "{FileList}"
  43.         echo "{file}" >> "{FileList}"        # Add it now.
  44.         continue                            # And don't ask the user.
  45.     end
  46.     # If there is more than one, ask the user for help in choosing.
  47.     set tmp "`getlistitem -q -m "The Master ∂"{file}∂" is" < "{FileList}".us ∂
  48.         || set sstatus {status}`"
  49.     if {sstatus} != 0        # If cancel, then cleanup and exit.
  50.         #delete "{FileList}".us "{FileList}".loc
  51.         #exit 2
  52.         continue    #    Have cancel skip this particular match, and go on to the next one
  53.     end  # end of if cancel
  54.     echo "{tmp}" >> "{FileList}"    
  55.     echo "{file}" >> "{FileList}"            # Add the user's choice to the list.
  56. end
  57.  
  58. #    Clean up and exit.
  59.  
  60.     delete "{FileList}".us "{FileList}".loc    # Remove the temp files.
  61.  
  62. #    Alert "The following File List was created:∂n∂n∂t" ∂""{FileList}"∂"
  63.  
  64.     
  65. #    Restore shell variables and exit
  66.  
  67.     directory    "{saveDir}"            # Leave the directory setting unchanged
  68.     set echo    {saveEcho}             # restore echo
  69.     set exit    "{saveExit}"